package com.badger.comsumer;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.EnableKafka;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Component
@EnableKafka
public class UserLogConsumer {

    @KafkaListener(topics = { "electricity" }, id = "test5")
    public void consumer(ConsumerRecord<String, String> consumerRecord) {
        System.out.println(String.format("消息消费 key:%s; offset :%s; message:%s--》", consumerRecord.key(),
                consumerRecord.offset(), consumerRecord.value()));
    }
}